package pfc;

/**
 *
 * @author <Mejico, Rocío; Mignola, Natalia; Ordoñez, Agustina>
 */
public class Util {

    public Util() {
    }

    public String replaceString(String path) {
        String ret = replaceAllString(path, "\\", "/");
        return ret;
    }

    public String replaceAllString(String strOrig, String strFind, String strReplace) {
        if (strOrig == null) {
            return null;
        }
        StringBuffer sb = new StringBuffer(strOrig);
        String toReplace = "";
        if (strReplace == null) {
            toReplace = "";
        } else {
            toReplace = strReplace;
        }
        int pos = strOrig.length();
        while (pos > -1) {
            pos = strOrig.lastIndexOf(strFind, pos);
            if (pos > -1) {
                sb.replace(pos, pos + strFind.length(), toReplace);
            }
            pos = pos - strFind.length();
        }
        return sb.toString();
    }

    /** Cambia las barras \ por barras /
     */
    public String obtenerCamino(String caminoOriginal) {
        String camino = caminoOriginal;
        camino = replaceString(camino);
        return camino;
    }
}
